Skip to content

feat: Go CLI skeleton — version command and lola mod stubs#188

Merged
SecKatie merged 12 commits into
LobsterTrap:mainfrom
mrbrandao:go-port-00
Jun 15, 2026
Merged

feat: Go CLI skeleton — version command and lola mod stubs#188
SecKatie merged 12 commits into
LobsterTrap:mainfrom
mrbrandao:go-port-00

Conversation

@mrbrandao

@mrbrandao mrbrandao commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

Bootstraps the Lola Go CLI with the initial project structure, version
command, and lola mod skeleton. This is the first PR in the Go port
series (go-port-00), establishing the foundation for all subsequent
command implementations.

  • Bootstrap Go CLI with Cobra (main.go, cmd/root.go)
  • lola version / lola --version / lola -v with dynamic version
    resolution (ldflags → go install module version → VCS commit hash →
    0.0.0-dev fallback)
  • lola mod command group with 6 no-op subcommands: add, rm, ls,
    info, update, init
  • internal/modules/ domain package with stub functions and per-package
    error sentinel (ErrNotImplemented)
  • mk/go.mk with go-build, go-test, go-vet Makefile targets
  • .gitignore updated with Go and SuperPowers sections

Test plan

  • lola --version / lola -v prints version string (e.g. 0.0.0-dev+279d87c)
  • lola version prints lola version 0.0.0-dev+279d87c linux/amd64
  • lola mod --help lists all 6 subcommands, no search
  • Each lola mod <sub> prints not yet implemented to stderr, exits 1
  • Arg validation rejects wrong arg count before hitting stubs
  • make go-test passes
  • make go-vet clean

Related issues

Closes #182 — Go project skeleton
Part of the Go migration (ADR: go-migration)

AI Disclosure

AI-assisted with Claude Code

Summary by CodeRabbit

  • New Features
    • Added mod subcommands (add, rm, ls, info, update, init) for module management (currently scaffolded and returns “not yet implemented”).
    • Added a version command with resolved version details and GOOS/GOARCH.
  • Bug Fixes
    • Improved CLI execution flow to return errors from the root command and exit with a non-zero status.
  • Chores
    • Added Go module setup, Makefile Go build targets, and expanded local ignore rules.
  • Tests
    • Added unit tests for version resolution across common release and development scenarios.

@mrbrandao mrbrandao added the enhancement New feature or request label Jun 11, 2026
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2d458434-e6da-4f76-8019-385f8589422d

📥 Commits

Reviewing files that changed from the base of the PR and between 0d17ee2 and f60fe73.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (16)
  • .gitignore
  • Makefile
  • cmd/mod.go
  • cmd/root.go
  • cmd/version.go
  • cmd/version_test.go
  • go.mod
  • internal/modules/add.go
  • internal/modules/errors.go
  • internal/modules/info.go
  • internal/modules/init.go
  • internal/modules/ls.go
  • internal/modules/rm.go
  • internal/modules/update.go
  • main.go
  • mk/go.mk
✅ Files skipped from review due to trivial changes (1)
  • .gitignore
🚧 Files skipped from review as they are similar to previous changes (15)
  • internal/modules/errors.go
  • internal/modules/add.go
  • internal/modules/info.go
  • internal/modules/init.go
  • cmd/version_test.go
  • go.mod
  • internal/modules/rm.go
  • internal/modules/ls.go
  • internal/modules/update.go
  • cmd/root.go
  • main.go
  • cmd/version.go
  • Makefile
  • cmd/mod.go
  • mk/go.mk

📝 Walkthrough

Walkthrough

This PR establishes the Go project skeleton for lola, introducing build infrastructure, a Cobra-based CLI framework with root and version commands, and a module management command group with operation stubs that currently return a sentinel "not yet implemented" error.

Changes

Go Project Skeleton

Layer / File(s) Summary
Build and Project Setup
.gitignore, Makefile, go.mod, mk/go.mk
Project configuration for Go development: ignore rules for Go artifacts and tooling, module definition with dependencies (Cobra, pflag, mousetrap), Makefile include directive, and build targets for compilation with version injection via git tags, testing, and linting.
CLI Framework and Version Resolution
cmd/root.go, cmd/version.go, cmd/version_test.go, main.go
Entry point and root command setup with version resolution via build-time injection, module build info fallback, truncated git commit hash, or development default. Version subcommand prints platform info. Comprehensive table-driven tests validate version resolution across release, development, and missing-context scenarios.
Module Management Command Structure
cmd/mod.go, internal/modules/errors.go, internal/modules/add.go, internal/modules/rm.go, internal/modules/ls.go, internal/modules/info.go, internal/modules/init.go, internal/modules/update.go
Mod command group with six subcommands (add, rm, ls, info, init, update), each requiring or accepting appropriate arguments and delegating to corresponding stub functions in the modules package. Shared error sentinel enables unified "not yet implemented" response for all operations pending future development.

Sequence Diagram

sequenceDiagram
  participant main as main()
  participant Execute as cmd.Execute()
  participant rootCmd as rootCmd
  participant currentVersion as currentVersion()
  participant resolveVersion as resolveVersion()
  participant versionCmd as versionCmd
  
  main->>Execute: invoke
  Execute->>rootCmd: rootCmd.Execute()
  rootCmd->>currentVersion: Load version
  currentVersion->>resolveVersion: Resolve with<br/>fallback chain
  resolveVersion-->>currentVersion: Return version
  currentVersion-->>rootCmd: Set version
  rootCmd->>versionCmd: Register and run
  versionCmd-->>rootCmd: Print version +<br/>platform info
  rootCmd-->>Execute: Return result
  Execute-->>main: Exit(1) on error
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • sergio-correia
  • SecKatie

Poem

🐰 A skeleton of Go, now taking form,
With Cobra's framework keeping CLI warm,
Version strings resolved through fallback chains,
Mod commands waiting—no implementation pains!
Building blocks in place, the foundation's strong. 🏗️

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 57.14% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: establishing a Go CLI skeleton with a version command and module management command stubs.
Linked Issues check ✅ Passed All objectives from issue #182 are met: Go project skeleton established, phased scaffolding provided, no-op commands created with project structure laid out.
Out of Scope Changes check ✅ Passed All changes are directly aligned with establishing the Go CLI skeleton and module management stubs as specified in issue #182.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5e2ae4b9dc

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread go.mod
@rjeffman

Copy link
Copy Markdown
Collaborator

Note: This is not a review.

@mrbrandao try to use an agent to extract the feature files from #184 and write the steps for Go to check the feasibility of that PR for the Go implementation. (No need to change this PR, just a test to see how it goes.)

@mrbrandao

Copy link
Copy Markdown
Collaborator Author

Note: This is not a review.

@mrbrandao try to use an agent to extract the feature files from #184 and write the steps for Go to check the feasibility of that PR for the Go implementation. (No need to change this PR, just a test to see how it goes.)

sounds good, will be separating an MR just with that

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
cmd/root.go (1)

24-29: ⚡ Quick win

Return errors from Execute() and exit only in main().

Handling os.Exit inside cmd.Execute() makes command execution harder to test and reuse.

Refactor proposal
--- a/cmd/root.go
+++ b/cmd/root.go
@@
-import (
-	"os"
-
-	"github.com/spf13/cobra"
-)
+import "github.com/spf13/cobra"
@@
-func Execute() {
-	err := rootCmd.Execute()
-	if err != nil {
-		os.Exit(1)
-	}
+func Execute() error {
+	return rootCmd.Execute()
 }
--- a/main.go
+++ b/main.go
@@
 package main
 
-import "github.com/LobsterTrap/lola/cmd"
+import (
+	"os"
+
+	"github.com/LobsterTrap/lola/cmd"
+)
 
 func main() {
-	cmd.Execute()
+	if err := cmd.Execute(); err != nil {
+		os.Exit(1)
+	}
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmd/root.go` around lines 24 - 29, The Execute() function is handling
os.Exit() internally, which prevents proper testing and reuse of the command
execution logic. Refactor Execute() to return the error from rootCmd.Execute()
instead of handling the exit directly. Move the os.Exit() call to the main()
function where the returned error can be checked and the process can be exited
appropriately. This allows Execute() to be tested and reused without side
effects.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cmd/root.go`:
- Around line 18-21: The quick-start help text in the Long field of the root
command in cmd/root.go references the lola install command which does not yet
exist in the codebase. Remove the line containing lola install [module] -a
[assistant] from the help text to prevent users from attempting to use a
non-existent command.

In `@main.go`:
- Around line 1-4: The copyright header in main.go contains placeholder template
text "NAME HERE <EMAIL ADDRESS>" that must be replaced with actual
project-specific copyright information. Either replace the placeholder with the
appropriate copyright holder name and email, or remove the placeholder entirely
and finalize the copyright header text later when project details are confirmed.
Update the comment block at the beginning of the file to reflect the actual
copyright requirements for this project.

---

Nitpick comments:
In `@cmd/root.go`:
- Around line 24-29: The Execute() function is handling os.Exit() internally,
which prevents proper testing and reuse of the command execution logic. Refactor
Execute() to return the error from rootCmd.Execute() instead of handling the
exit directly. Move the os.Exit() call to the main() function where the returned
error can be checked and the process can be exited appropriately. This allows
Execute() to be tested and reused without side effects.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d465517f-9c69-48a8-bdf0-d718cb065eea

📥 Commits

Reviewing files that changed from the base of the PR and between b96a95a and 415dd32.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (16)
  • .gitignore
  • Makefile
  • cmd/mod.go
  • cmd/root.go
  • cmd/version.go
  • cmd/version_test.go
  • go.mod
  • internal/modules/add.go
  • internal/modules/errors.go
  • internal/modules/info.go
  • internal/modules/init.go
  • internal/modules/ls.go
  • internal/modules/rm.go
  • internal/modules/update.go
  • main.go
  • mk/go.mk
✅ Files skipped from review due to trivial changes (2)
  • .gitignore
  • internal/modules/ls.go
🚧 Files skipped from review as they are similar to previous changes (10)
  • go.mod
  • internal/modules/update.go
  • cmd/version_test.go
  • internal/modules/info.go
  • internal/modules/add.go
  • cmd/version.go
  • mk/go.mk
  • internal/modules/init.go
  • internal/modules/errors.go
  • cmd/mod.go

Comment thread cmd/root.go
Comment thread main.go Outdated
@mrbrandao

Copy link
Copy Markdown
Collaborator Author

Keeping lola install [module] -a [assistant] in the Long description intentionally — this is a skeleton PR and lola install is part of the planned command surface (tracked in the Go migration). Removing it now would mean adding it back when the command lands, which is unnecessary churn. The help text documents the intended UX, not the current implementation state.

mrbrandao and others added 12 commits June 15, 2026 16:43
Add .tool-versions to .gitignore to prevent local asdf
version configuration from being tracked by git.
Initialize Go module and root command scaffold for the lola
CLI, using github.com/spf13/cobra as the CLI framework.
… domain

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… test

- Replace currentVersion() call in versionCmd.Run with cmd.Root().Version for
  single source of truth between 'lola version' and 'lola --version'
- Add boundary test case for exactly 7-char vcsRevision to cover
  min(7, len(vcsRevision)) logic
- All tests pass including new case

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Adds Go build targets to the Makefile alongside existing Python targets.
Includes version stamping from git tags via LDFLAGS when on a tag,
otherwise falls through to VCS stamping for dev builds.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Add standard Go ignores (binaries, test artifacts, coverage output,
go.work), exclude also custom bin/ dir
@SecKatie SecKatie merged commit 10d1fa4 into LobsterTrap:main Jun 15, 2026
6 checks passed
@mrbrandao mrbrandao deleted the go-port-00 branch June 15, 2026 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] - Go project skeleton

3 participants